package com.hrbxlh.virtualization.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hrbxlh.virtualization.pojo.Image;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.beans.BeanUtils;

/**
 * @author cheer
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ImageVO {

    /**
     * 镜像Id
     */
    private Long id;

    /**
     * 镜像名称
     */
    private String name;

    /**
     * 镜像来源
     */
    private String imageSource;

    /**
     * 状态码
     */
    private Integer statusCode;

    /**
     * 状态信息
     */
    private String status;

    /**
     * 是否共享
     */
    private Boolean shared;

    public ImageVO convertFor(Image image) {
        BeanUtils.copyProperties(image, this);
        name = image.getImageName();
        return this;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImageSource() {
        return imageSource;
    }

    public void setImageSource(String imageSource) {
        this.imageSource = imageSource;
    }

    public Integer getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Boolean getShared() {
        return shared;
    }

    public void setShared(Boolean shared) {
        this.shared = shared;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("name", name)
                .append("imageSource", imageSource)
                .append("statusCode", statusCode)
                .append("status", status)
                .append("shared", shared)
                .toString();
    }
}
